import request from "./request.js";
class agriknow {
  constructor() {
   this._baseUrl = 'https://www.ptcxmy.com/'//渗透测试服务器
   //this._baseUrl = 'http://htkjapp.v5.idcfengye.com/' //渗透测试服务器
    this._defaultHeader = { "data-tupe": "application/json" };
    this._request = new request();
    // this._request.setErrorHandler(this.errorHander);
  }
  //  统一的异常处理方法01.
  errorHander(res) {
    console.error(res);
  } 
  //微信授权登录 app/auth/LoginByMa
  postLoginByMa(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/wxLogin", dataVal)
      .then((res) => res.data);
  }
  //文件上传
  uploadImage(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/uploadImage", dataVal)
      .then((res) => res.data);
  }
  //个人中心
  userHome(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/userHome", dataVal)
      .then((res) => res.data);
  }
  //订单列表
  userOrderList(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/userOrderList", dataVal)
      .then((res) => res.data);
  }
  //首页banner
  banner(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/banner", dataVal)
      .then((res) => res.data);
  }

  // 获取首页点击列表
  getClickList(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/homeType", dataVal)
      .then((res) => res.data);
  }

  // 商家入驻
  userApplyStore(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/userApplyStore", dataVal)
      .then((res) => res.data);
  }

  // 获取文案
  getCopy(data) {
    let dataVal = data;
    return this._request
      .postRequest(this._baseUrl + "ht/user/getCopy", dataVal)
      .then((res) => res.data);
  }

  // 获取商家列表
  getStoreList(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/storeList", dataVal)
    .then(res => res.data)
  }


  // 获取店铺详情根据id
  getStoreDetail(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "/ht/user/storeDetails", dataVal).then(res => res.data)
  }

  // 获取评论列表
  getpllist(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "/ht/user/storeComment", dataVal).then(res => res.data)
  }

  // /ht/user/userCollect 用户收藏
  userCollect(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "/ht/user/userCollect", dataVal).then(res => res.data)
  }

  // /ht/user/proDetails 商品详情
  proDetails(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "/ht/user/proDetails", dataVal).then(res => res.data)
  }

  // 获取商品类型
  storeTypeList(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/storeTypeList", dataVal)
    .then(res => res.data)
  }

  // 获取商品列表
  foodList(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/foodList", dataVal)
    .then(res => res.data)
  }

  // 用户下单
  userBuy(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userBuy", dataVal)
    .then(res => res.data)
  }

  // 订单详情（到店订单）
  userOrderDetails(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userOrderDetails", dataVal)
    .then(res => res.data)
  }

  // 团购核销订单
  userQrOrderDetails(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userQrOrderDetails", dataVal)
    .then(res => res.data)
  }

  // 团购核销订单
  userNotCommentOrderList(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userNotCommentOrderList", dataVal)
    .then(res => res.data)
  }

  // 用户提交评价
  userComment(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userComment", dataVal)
    .then(res => res.data)
  }
  

  // 支付
  userPayOrder(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/storeSftOrder", dataVal)
    .then(res => res.data)
  }

    // 支付
    yplPayOrder(data){
      let dataVal = data;
      return this._request.postRequest(this._baseUrl + "ht/user/yplPayOrder", dataVal)
      .then(res => res.data)
    }

  
  // 根据桌子获取商家id
  getStoreId(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/store/getStoreId", dataVal)
    .then(res => res.data)
  }
  // 用户扫码支付
  userPayQr(data){
    let dataVal = data;
    return this._request.postRequest(this._baseUrl + "ht/user/userPayQr", dataVal)
    .then(res => res.data)
  }
  
} 
export default agriknow;
